<?php
namespace BP\Sys;
require_once("java/util/Date.php");
require_once("java/util/Enumeration.php");
abstract class FrmEventBase {
	protected $Row;	// Row
	abstract function getFrmNo (); 
	public function getOID () 
	{
		return $this->GetValInt("OID");
	}
	public function getWorkID () 
	{
		if (($this->getOID() == 0))
		{
			return $this->GetValInt64("WorkID");
		}
		return $this->getOID();
	}
	public function getFID () 
	{
		return $this->GetValInt64("FID");
	}
	public function getWorkIDs () 
	{
		return $this->GetValStr("WorkIDs");
	}
	public function getNos () 
	{
		return $this->GetValStr("Nos");
	}
	public function getRow () 
	{
		return $this->Row;
	}
	public function setRow ($value) // [Row value]
	{
		$this->Row = $value;
	}
	public function GetValDateTime ($key) // [String key]
	{
		try 
		{
			$str = $this->getRow()->GetValByKey($key);
			return $DataType->ParseSysDateTime2DateTime($str);
		}
		catch (\RuntimeException $ex)
		{
			throw new \RuntimeException(((("@流程事件实体在获取参数期间出现错误，请确认字�?(" . $key) . ")是否拼写正确,�?术信�?:") . $ex->getMessage()));
		}
	}
	public function GetValStr ($key) // [String key]
	{
		try 
		{
			return $this->getRow()->GetValByKey($key);
		}
		catch (\RuntimeException $ex)
		{
			throw new \RuntimeException(((("@流程事件实体在获取参数期间出现错误，请确认字�?(" . $key) . ")是否拼写正确,�?术信�?:") . $ex->getMessage()));
		}
	}
	public function GetValInt64 ($key) // [String key]
	{
		return $Long->parseLong($this->GetValStr($key));
	}
	public function GetValInt ($key) // [String key]
	{
		return $Integer->parseInt($this->GetValStr($key));
	}
	public function GetValBoolen ($key) // [String key]
	{
		if (($Integer->parseInt($this->GetValStr($key)) == 0))
		{
			return  FALSE ;
		}
		return  TRUE ;
	}
	public function GetValDecimal ($key) // [String key]
	{
		return new BigDecimal($this->GetValStr($key));
	}
	public static function constructor__ () 
	{
		$me = new self();
		return $me;
	}
	public function FrmLoadAfter () 
	{
		return NULL;
	}
	public function FrmLoadBefore () 
	{
		return NULL;
	}
	public function SaveAfter () 
	{
		return NULL;
	}
	public function SaveBefore () 
	{
		return NULL;
	}
	public function CreateOID () 
	{
		return NULL;
	}
	public function DoIt ($eventType, $en, $row, $atPara) // [String eventType, Entity en, Row row, String atPara]
	{
		$this->setRow($row);
		$r = $en->getRow();
		try 
		{
			$this->getRow()->put("FK_MapData", $en->getClassID());
		}
		catch (\Exception $e)
		{
			$this->getRow()->put("FK_MapData", $en->getClassID());
		}
		if (($atPara . NULL))
		{
			$ap = new AtPara($atPara);
			foreach ($ap->getHisHT()->keySet() as $s) 			{
				try 
				{
					$this->getRow()->put($s, $ap->GetValStrByKey($s));
				}
				catch (\Exception $e2)
				{
					$this->getRow()->put($s, $ap->GetValStrByKey($s));
				}
			}
		}
		if ((SystemConfig::getIsBSsystem() ==  TRUE ))
		{
			$enu = Glo->getRequest()->getParameterNames();
			while ($enu->hasMoreElements()) 
			{
				$key = $enu->nextElement();
				$this->getRow()->put($key, Glo->getRequest()->getParameter($key));
			}
		}
		switch ($eventType) {
			case EventListOfNode::$CreateWorkID:
				return $this->CreateOID();
			case EventListOfNode::$FrmLoadAfter:
				return $this->FrmLoadAfter();
			case EventListOfNode::$FrmLoadBefore:
				return $this->FrmLoadBefore();
			case EventListOfNode::$SaveAfter:
				return $this->SaveAfter();
			case EventListOfNode::$SaveBefore:
				return $this->SaveBefore();
			default:
				throw new \RuntimeException(("@没有判断的事件类�?:" . $eventType));
		}
	}
}
?>
